﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList2.Items.Add("福建");
                DropDownList2.Items.Add("山东");
                DropDownList2.Items.Add("广东");
            }
        }

        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string province = DropDownList2.SelectedValue;
            DropDownList3.Items.Clear();

            if (province == "福建")
            {
                DropDownList3.Items.Add("龙岩");
                DropDownList3.Items.Add("厦门");
                DropDownList3.Items.Add("漳州");
            }
            else if (province == "山东")
            {
                DropDownList3.Items.Add("潍坊");
                DropDownList3.Items.Add("长廊");
            }
            else
            {
                DropDownList3.Items.Add("湛江");
                DropDownList3.Items.Add("深圳");
                DropDownList3.Items.Add("珠海");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string hob = null;
            for (int i = 0; i < CheckBoxList1.Items.Count; i++)
            {
                if (CheckBoxList1.Items[i].Selected)
                {
                    hob += CheckBoxList1.Items[i] + " ";
                }
            }
           
            Literal1.Text = $"账号：{TextBox1.Text},性别：{DropDownList1.SelectedValue},爱好：{hob},籍贯:{DropDownList2.SelectedValue},其他信息:{TextBox3.Text}";
        }
    }
}